package com.yl.pattern.structuralmodel.combination;

/**
 * @Author 小羊
 * @Date 31/10/2024下午 2:10
 * @ClassName MenuComponent
 * @Description 菜单组件(抽象根节点)
 */
public abstract class MenuComponent {
    /**
     * 菜单组件的名称
     */
    protected String name;
    /**
     * 菜单组件的层级
     */
    protected int level;

    /**
     * 添加子菜单
     * @param menuComponent
     */
    public void add(MenuComponent menuComponent){
        throw new UnsupportedOperationException();
    }

    /**
     * 移除子菜单
     * @param menuComponent
     */
    public void remove(MenuComponent menuComponent){
        throw new UnsupportedOperationException();
    }

    /**
     * 获取指定子菜单
     * @param i
     * @return
     */
    public MenuComponent getChild(int i){
        throw new UnsupportedOperationException();
    }

    /**
     * 获取菜单或者菜单项的名称
     * @return
     */
    public String getName(){
        return name;
    }

    /**
     * 打印菜单
     */
    public abstract void print();
}
